<?php
/**
 * 应用程序信息
 * 
 * 用于描述一个应用程序.该实例只能从appinfo.xml文件创建,应用程序可以没有描述信息.
 * 
 * @author Leo 2010-10-25
 *
 */

class AppMeta extends XmlNode {
	var $appname = '';
	var $author = '';
	var $version = '';
	var $appurl = '';
	var $authorurl = '';
	var $descripition = '';
	var $upgradeurl = '';
	public function __construct($appinfo) {
		parent::__construct ( 'app', $appinfo );
		$this->appname = $this->attr ( 'name' );
		$this->version = $this->attr ( 'version' );
		$this->author = $this->attr ( 'author', 'Unkown' );
		$desc = $this->get ( 'desc' ); //描述
		if ($desc) {
			$this->descripition = $desc->value ();
		}
		$upgrade = $this->get ( 'upgrade' ); //描述
		if ($upgrade) {
			$this->upgradeurl = $upgrade->value ();
		}
		$apphome = $this->get ( 'home/app' );
		if ($apphome) {
			$this->appurl = $apphome->value ();
		}
		$authorhome = $this->get ( 'home/author' );
		if ($authorhome) {
			$this->authorurl = $authorhome->value ();
		}
	}
	/**
	 * 读取应用中
	 * @param boolean $embed
	 * @param string  $name 脚本名称
	 */
	public function scripts($embed = false, $name = '') {
		
	}
	
	public function styles($embed = false, $name = '') {
		
	}
	/**
	 * 安装
	 * @param Filesystem $filesystem
	 */
	public function install($filesystem) {
		//TODO 
	}
	/**
	 * 卸载
	 * @param Filesystem $filesystem
	 */
	public function uninstall($filesystem) {
		//TODO 
	}
	/**
	 * 升级
	 * @param Filesystem $filesystem
	 */
	public function update($filesystem) {
		//TODO 
	}
	/**
	 * 是否有可用更新
	 * @param Filesystem $filesystem
	 */
	public function updatable() {
		//TODO 
	}

}